// components/searchInput/searchInput.js
Component({
  options: {
    addGlobalClass: true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    placeholder: {
      type: String,
      value: '搜索'
    },
    focus: {
      type: Boolean,
      value: false
    },
    value: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    clearInput: function clearInput() {
      this.setData({
        value: ''
      });
      this.triggerEvent('clear');
    },
    inputChange: function inputChange(e) {
      this.setData({
        value: e.detail.value
      });
    },
    inputConfirm(e){
      this.triggerEvent('search',e.detail.value);
    }
  }
})
